package com.thoughtworks.university.biblioteca;

/**
 * Created by sravanns on 10/06/14.
 */
public class ReturnBook {
    private String book_name;
    public ReturnBook(String name_return) {
        book_name=name_return;
    }

    public boolean doAction() {

        ListBooks catalog=new ListBooks();
        Book book=catalog.is_available_catalog(book_name);
        if(book!=null)
        {
            if(new BibliotecaApp().remove(book))
            {
                System.out.println("Thank you for returning the book.");
                return true;
            }
            else {
                System.out.println("That is not a valid book to return.");
                return false;
            }

        }
        else {
            System.out.println("That book is not valid book in Library. please consider checking the spelling");
            return false;
        }
    }
}
